#include "FileReceiver.h"
#include <iostream>
#include <string>
#include <vector>

#define DEFAULT_PORT 9001

int main(int argc, char* argv[]) {
    if (argc >= 3 && std::string(argv[1]) == "multiudp") {
        int listen_port = atoi(argv[2]);
        std::vector<std::string> binNames = {"BIN1", "BIN2", "BIN3", "BIN4"};
        FileReceiver receiver(binNames, listen_port);
        receiver.recvMultiUDP();
        return 0;
    }
    std::string protocol = "udp";
    int listen_port = DEFAULT_PORT;
    std::string save_path = "./receiveddata/received.bin";
    if (argc > 1) protocol = argv[1];
    if (argc > 2) listen_port = atoi(argv[2]);
    if (argc > 3) save_path = argv[3];
    FileReceiver receiver(save_path, listen_port);
    if (protocol == "udp") {
        receiver.recvUDP();
    } else if (protocol == "tcp") {
        receiver.recvTCP();
    } else {
        std::cerr << "Unknown protocol: " << protocol << std::endl;
        return 1;
    }
    return 0;
} 